﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ChimneySim
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }

        public PictureBox Canvas
        {
            get
            {
                return canvas;
            }
        }

        public IntPtr CanvasHandle
        {
            get
            {
                return canvas.Handle;
            }
        }

        public Size CanvasSize
        {
            get
            {
                return canvas.Size;
            }
        }

        private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.Exit();
        }

        private void exitButton_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void roomTemp0NB_ValueChanged(object sender, EventArgs e)
        {
            if (Math.Abs(roomTemp0NB.Value - roomTemp1NB.Value) > (decimal)0.5)
            {
                if (roomTemp0NB.Value > roomTemp1NB.Value)
                {
                    roomTemp0NB.Value = roomTemp1NB.Value + (decimal)0.49;
                }
                else
                {
                    roomTemp0NB.Value = roomTemp1NB.Value - (decimal)0.49;
                }
            }
        }

        private void roomTemp1NB_ValueChanged(object sender, EventArgs e)
        {
            if (Math.Abs(roomTemp0NB.Value - roomTemp1NB.Value) > (decimal)0.5)
            {
                if (roomTemp1NB.Value > roomTemp0NB.Value)
                {
                    roomTemp1NB.Value = roomTemp0NB.Value + (decimal)0.49;
                }
                else
                {
                    roomTemp1NB.Value = roomTemp0NB.Value - (decimal)0.49;
                }
            }
        }
    }
}
